package com.example.photongrid;
import java.net.*;
import java.util.ArrayList;
import java.util.Enumeration;
import java.io.*;

import android.util.Log;

public class ServerGame implements Runnable
{	
	public static Board board;
	public static ArrayList<VehicleList> vehicles;
	public static ArrayList<WallList> walls;
	private int setupDone;
	private int startGame;
	public static int updateFlag=0;
	ServerGame()
	{
		setupDone = 0;
		board = new Board();
		startGame = 0;
	
	}
	
	@Override
	public void run() {
	
			if(setupDone == 0)
			{
			board.preparegame();
			setupDone = 1;
			}
			if(startGame == 1)
			{
				try {
					board.updateBoard(false);
					updateFlag = 1;
				} catch (InterruptedException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
			try {
				Thread.sleep(16);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			
		
		
		
			 
			
		
		
	}
	
	public void startGame()
	{
		startGame = 1;
	}
	
	public void setStartGame(int i)
	{
		startGame = i;
	}
	
	
	
	
	
	
	
}